import Vue from 'vue'
import VueRouter from 'vue-router'

import homePage from '../components/homePage/homePage.vue'
import selfBlog from '../components/selfBlog/selfBlog.vue'
import editBlog from '../components/editBlog/editBlog'
import selfLife from '../components/selfLife/selfLife.vue'
import loginPage from '../components/loginPage/loginPage.vue'
import registerPage from '../components/registerPage/registerPage.vue'
import userPage from '../components/userPage/userPage.vue'
import checkInfo from '../components/userPage/checkInfo.vue'
import editInfo from '../components/userPage/editInfo'

Vue.use(VueRouter)

const router = new VueRouter({
  routes: [
    {
      path: '/homePage',
      component: homePage
    },
    {
      path: '/selfBlog',
      component: selfBlog
    },
    {
      path: '/editBlog',
      name: 'editBlog',
      component: editBlog
    },
    {
      path: '/selfLife',
      component: selfLife
    },
    {
      path: '/loginPage',
      component: loginPage
    },
    {
      path: '/registerPage',
      component: registerPage
    },
    {
      path: '/userPage',
      component: userPage,
      children: [
        {
          path: 'checkInfo',
          component: checkInfo
        },
        {
          path: 'editInfo',
          component: editInfo
        },
        {
          path: '/',
          redirect: 'checkInfo'
        },
        {
          path: '*',
          redirect: 'checkInfo'
        }
      ]
    },
    {
      path: '*',
      redirect: '/homePage'
    }
  ]
})

export default router
